/********************************************************
 Name          : FP_00023_020.h
 Author        : Khachatur Gyozalyan
 Copyright     : Copyright by Antel Systems
 Description   :
 **********************************************************/

#ifndef _FP_00023_020_H_
#define _FP_00023_020_H_


#include "compiler.h"



// RCOsc has no custom calibration by default. Set the following definition to
// the appropriate value if a custom RCOsc calibration has been applied to your
// part.
#define FRCOSC          AVR32_PM_RCOSC_FREQUENCY              //!< RCOsc frequency: Hz.

#define FOSC32          32768                                 //!< Osc32 frequency: Hz.
#define OSC32_STARTUP   AVR32_PM_OSCCTRL32_STARTUP_8192_RCOSC //!< Osc32 startup time: RCOsc periods.

#define FOSC0           12288000//19200000                              //!< Osc0 frequency: Hz.
#define OSC0_STARTUP    AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC  //!< Osc0 startup time: RCOsc periods.

// Osc1 crystal is not mounted by default. Set the following definitions to the
// appropriate values if a custom Osc1 crystal is mounted on your board.
//#define FOSC1           12000000                              //!< Osc1 frequency: Hz.
//#define OSC1_STARTUP    AVR32_PM_OSCCTRL1_STARTUP_2048_RCOSC  //!< Osc1 startup time: RCOsc periods.



/*! \name SPI Connections of the AT25DFX,CMX7164,HDG104 Components
 */
//! @{
#define SPI_MODULE                 (&AVR32_SPI)
#define AT25DFX_SPI_NPCS            0
#define HDG104_SPI_NPCS             1
#define CMX7164_SPI_NPCS            2
#define SPI_SCK_PIN                 AVR32_SPI_SCK_0_0_PIN
#define SPI_SCK_FUNCTION            AVR32_SPI_SCK_0_0_FUNCTION
#define SPI_MISO_PIN                AVR32_SPI_MISO_0_0_PIN
#define SPI_MISO_FUNCTION           AVR32_SPI_MISO_0_0_FUNCTION
#define SPI_MOSI_PIN                AVR32_SPI_MOSI_0_0_PIN
#define SPI_MOSI_FUNCTION           AVR32_SPI_MOSI_0_0_FUNCTION
#define AT25DFX_SPI_NPCS_PIN        AVR32_SPI_NPCS_0_0_PIN
#define AT25DFX_SPI_NPCS_FUNCTION   AVR32_SPI_NPCS_0_0_FUNCTION
#define HDG104_SPI_NPCS_PIN         AVR32_SPI_NPCS_1_0_PIN
#define HDG104_SPI_NPCS_FUNCTION    AVR32_SPI_NPCS_1_0_FUNCTION
#define CMX7164_SPI_NPCS_PIN        AVR32_SPI_NPCS_2_0_PIN
#define CMX7164_SPI_NPCS_FUNCTION   AVR32_SPI_NPCS_2_0_FUNCTION
#define CMX7164_GPIO_IRQ_PIN 		AVR32_EIC_EXTINT_0_PIN
#define CMX7164_GPIO_IRQ_FUNCTION	AVR32_EIC_EXTINT_0_FUNCTION

//! @}

#define SWCTRL				AVR32_PIN_PA11

#define SLEEP_PIN				AVR32_PIN_PA20


#define USART1               (&AVR32_USART1)
#define USART1_RX_PIN        AVR32_USART1_RXD_0_0_PIN
#define USART1_RX_FUNCTION   AVR32_USART1_RXD_0_0_FUNCTION
#define USART1_TX_PIN        AVR32_USART1_TXD_0_0_PIN
#define USART1_TX_FUNCTION   AVR32_USART1_TXD_0_0_FUNCTION
#define USART1_CLOCK_MASK    AVR32_USART1_CLK_PBA
#define USART1_IRQ           AVR32_USART1_IRQ
#define USART1_RTS_PIN		 AVR32_USART1_RTS_0_1_PIN
#define USART1_RTS_FUNCTION  AVR32_USART1_RTS_0_1_FUNCTION

#define INT0          0
#define INT1          1
#define INT2          2
#define INT3          3


#endif  // _FP_00023_020_H_
